package com.asnike.selector{
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.filters.GlowFilter;
	import flash.text.TextField;
	import flash.text.TextFormat;
	
	public class FinalStep extends Sprite{
		
		public var titleStep0:MovieClip;
		public var titleStep2:MovieClip;
		public var titleStep3:MovieClip;
		public var step0:MovieClip;
		public var step1:MovieClip;
		public var step2:MovieClip;
		public var step3:MovieClip;
		public var step4:TextField;
		public var envelop:MovieClip;
		
		public function FinalStep(){
			initTextField();
		}
		private function initTextField():void{
			var format:TextFormat;
			
			format = new TextFormat( 'ygo320', 12 );
			step4.defaultTextFormat = format;
			step4.embedFonts = true;
			step4.selectable = false;
			step4.filters = [new GlowFilter(0)];
		}
		
		public function setStep0Result( $value:int ):void{
			step0.gotoAndStop( $value + 1 );
			titleStep0.gotoAndStop( $value + 1 );
		}
		public function setStep1Result( $value:int ):void{
			step1.gotoAndStop( $value + 1 );
		}
		public function setStep2Result( $value:int ):void{
			step2.gotoAndStop( $value + 1 );
			envelop.gotoAndStop( $value + 1 );
			titleStep2.gotoAndStop( $value + 1 );
		}
		public function setStep3Result( $value:int ):void{
			step3.gotoAndStop( $value + 1 );
			titleStep3.gotoAndStop( $value + 1 );
		}
		public function setStep4Result( $value:Array ):void{
			var result:String;
			
			result = '';
			if( $value.length > 2 ){
				result += $value[0] + '\n' + $value[1] + '\n외 ' + String( $value.length - 2 ) + '종';
			}else{
				result += $value[0] + '\n' + $value[1];
			}
			step4.text = result;
		}
		
		public function show():void{
			visible = true;
		}
		public function hide():void{
			visible = false;
		}
	}
}